<?php
/**
 * The template for displaying all pages.
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site will use a
 * different template.
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */

get_header(); ?>
		<div id="primary">
			<div class="container" id="lista_produto" role="main">
				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
					<?php get_template_part( 'filtros'); ?>
					<h1 class="entry-title"><?php the_title() ?></h1>
					<div class="entry-content">
				<?php 
					$args = array(
                    	'posts_per_page'  => 15,
                    	'offset'          => 0,
                    	'category_name'   => 'queijos',
                    	'orderby'         => 'post_date',
                    	'order'           => 'DESC',
                    	'include'         => '',
                    	'exclude'         => '',
                    	'meta_key'        => '',
                    	'meta_value'      => '',
                    	'post_type'       => 'post',
                    	'post_mime_type'  => '',
                    	'post_parent'     => '',
                    	'post_status'     => 'publish',
                    	'suppress_filters' => true,
                    	'meta_query'   => array(
							array(
								'key'       => 'imagens',
								'value'     => '',
								'compare'   => '!=',
							),
						),

                    );
					query_posts($args);
					?> 
					<script>
					    jQuery(document).ready(function($) {
					        $(".carousel-queijos").jCarouselLite({
					            btnNext: ".next-queijos",
					            btnPrev: ".prev-queijos",
					            visible : 5,
					            scroll  : 5
					        });
					    });
					</script>
						<p class="titulo_categoria">
							Queijos
							<a href="<?php bloginfo('url');?>/category/produto/queijos"><img src="<?php bloginfo( 'template_url' );?>/images/ver_todos_produtos.jpg" alt="Veja todos Produtos"></a>
						</p>
						<div class="wrapper_carrossel">
							<a href="javascript:void(0)" class="prev prev-queijos"><img src="<?php bloginfo( 'template_url' );?>/images/prev.jpg" alt="Prev"></a>
							<a href="javascript:void(0)" class="next next-queijos"><img src="<?php bloginfo( 'template_url' );?>/images/next.jpg" alt="Prev"></a>
							<div class="carousel carousel-queijos">
								<ul>
								<?php while ( have_posts() ) : the_post(); ?>
									
		<?php 						//$array = get_post_custom_values('imagens'); 
									$tamanho="w=180&zc=1&q=100";
	   								$imagem = get_image('imagens',1,1,1,NULL,$tamanho);
		?>							
									<li>
										<a href="<?=the_permalink();?>" class="tooltip" title="<?=the_title();?>">
		<?php 								if($imagem != ''){ ?>
											<?php echo $imagem;?>
		<?php 								}else{ ?>
											<p>SEM IMAGEM</p>
		<?php 								} ?>
										</a>
									</li>

								<?php endwhile; // end of the loop. ?>
								</ul>
								<div class="clear"></div>
							</div>
						</div>
					

					<?php
					wp_reset_query();
					$args = array(
                    	'posts_per_page'  => 15,
                    	'offset'          => 0,
                    	'category_name'   => 'frios',
                    	'orderby'         => 'post_date',
                    	'order'           => 'DESC',
                    	'include'         => '',
                    	'exclude'         => '',
                    	'meta_key'        => '',
                    	'meta_value'      => '',
                    	'post_type'       => 'post',
                    	'post_mime_type'  => '',
                    	'post_parent'     => '',
                    	'post_status'     => 'publish',
                    	'suppress_filters' => true,
                    	'meta_query'   => array(
							array(
								'key'       => 'imagens',
								'value'     => '',
								'compare'   => '!=',
							),
						),

                    );
					query_posts($args);
?> 
					<script>
					    jQuery(document).ready(function($) {
					        $(".carousel-frios").jCarouselLite({
					            btnNext: ".next-frios",
					            btnPrev: ".prev-frios",
					            visible : 5,
					            scroll  : 5
					        });
					    });
					</script>
						<p class="titulo_categoria">
							Frios
							<a href="<?php bloginfo('url');?>/category/produto/frios"><img src="<?php bloginfo( 'template_url' );?>/images/ver_todos_produtos.jpg" alt="Veja todos Produtos"></a>
						</p>
						<div class="wrapper_carrossel">
							<a href="javascript:void(0)" class="prev prev-frios"><img src="<?php bloginfo( 'template_url' );?>/images/prev.jpg" alt="Prev"></a>
							<a href="javascript:void(0)" class="next next-frios"><img src="<?php bloginfo( 'template_url' );?>/images/next.jpg" alt="Prev"></a>
							<div class="carousel carousel-frios">
								<ul>
								<?php while ( have_posts() ) : the_post(); ?>
									
		<?php 						//$array = get_post_custom_values('imagens'); 
									$tamanho="w=180&zc=1&q=100";
	   								$imagem = get_image('imagens',1,1,1,NULL,$tamanho);
		?>							
									<li>
										<a href="<?=the_permalink();?>" class="tooltip" title="<?=the_title();?>">
		<?php 								if($imagem != ''){ ?>
												<?php echo $imagem;?>
		<?php 								}else{ ?>
												<p>SEM IMAGEM</p>
											<?php } ?>
										</a>
									</li>
							
								<?php endwhile; // end of the loop. ?>
								</ul>
								<div class="clear"></div>
							</div>
						</div>
					<?php
					wp_reset_query();
					$args = array(
						'type'                     => 'post',
						'child_of'                 => '',
						'parent'                   => '8',
						'orderby'                  => 'name',
						'order'                    => 'ASC',
						'hide_empty'               => 1,
						'hierarchical'             => 0,
						'exclude'                  => '15,10',
						'include'                  => '',
						'number'                   => '',
						'taxonomy'                 => 'category',
						'pad_counts'               => false 

					); 
					$categories = get_categories( $args ); 
					wp_reset_query();	
					foreach($categories as $category) { 

					$args = array(
                    	'posts_per_page'  => 15,
                    	'offset'          => 0,
                    	'category_name'   => $category->name,
                    	'orderby'         => 'post_date',
                    	'order'           => 'DESC',
                    	'include'         => '',
                    	'exclude'         => '',
                    	'meta_key'        => '',
                    	'meta_value'      => '',
                    	'post_type'       => 'post',
                    	'post_mime_type'  => '',
                    	'post_parent'     => '',
                    	'post_status'     => 'publish',
                    	'suppress_filters' => true,
                    	'meta_query'   => array(
							array(
								'key'       => 'imagens',
								'value'     => '',
								'compare'   => '!=',
							),
						),

                    );
					query_posts($args);
?> 
					<script>
					    jQuery(document).ready(function($) {
					        $(".carousel-<?=$category->slug;?>").jCarouselLite({
					            btnNext: ".next-<?=$category->slug;?>",
					            btnPrev: ".prev-<?=$category->slug;?>",
					            visible : 5,
					            scroll  : 5
					        });
					    });
					</script>
						<p class="titulo_categoria">
							<?php echo $category->name ?>
							<a href="<?php bloginfo('url');?>/category/produto/<?php echo $category->slug; ?>"><img src="<?php bloginfo( 'template_url' );?>/images/ver_todos_produtos.jpg" alt="Veja todos Produtos"></a>
						</p>
						<div class="wrapper_carrossel">
							<a href="javascript:void(0)" class="prev prev-<?=$category->slug;?>"><img src="<?php bloginfo( 'template_url' );?>/images/prev.jpg" alt="Prev"></a>
							<a href="javascript:void(0)" class="next next-<?=$category->slug;?>"><img src="<?php bloginfo( 'template_url' );?>/images/next.jpg" alt="Prev"></a>
							<div class="carousel carousel-<?=$category->slug;?>">
								<ul>
								<?php while ( have_posts() ) : the_post(); ?>
									<!-- <header class="entry-header">
										<h1 class="entry-title"><?php the_title(); ?></h1>
									</header>.entry-header -->
		<?php 						//$array = get_post_custom_values('imagens'); 
									$tamanho="w=180&zc=1&q=100";
	   								$imagem = get_image('imagens',1,1,1,NULL,$tamanho);
		?>							
									<li>
										<a href="<?=the_permalink();?>" class="tooltip" title="<?=the_title();?>">
		<?php 								if($imagem != ''){ ?>
											<?php echo $imagem;?>
		<?php 								}else{ ?>
											<p>SEM IMAGEM</p>
		<?php 								} ?>
										</a>
									</li>
							
								<?php endwhile; // end of the loop. ?>
								</ul>
								<div class="clear"></div>
							</div>
						</div>
<?php          		} ?>
					</div><!-- .entry-content -->
				</article><!-- #post-<?php the_ID(); ?> -->
				<div class="clear"></div>
			</div><!-- #content -->
		</div><!-- #primary -->
<?php get_sidebar('page'); ?>
<?php get_footer(); ?>